<template>
  <div class="card-wrapper">
    <div class="card-control">
      <i class="el-icon-close" @click="closeDetail"></i>
    </div>
    <div class="card-img">
      <img src="../../assets/card-img.png" />
    </div>
    <div class="card-desc">
      <!-- <div class="card-warning">
        <img src="../../assets/level1.png" />
        <span>{{ item.key1 }}</span>
      </div> -->
      <div class="card-title">{{ item.devicename }}</div>
      <div class="card-status"><em :class="{ 'text-green': item.onlinestatus == 1 }"></em>{{ item.onlinestatus == 0 ? '离线' : '在线' }}</div>
      <div class="card-line">
        <img src="../../assets/icon-loc.png" />{{ item.routeName }}
      </div>
      <div class="card-line">
        <img src="../../assets/icon-line.png" />{{ item.province }}{{ item.city }}{{ item.country }}{{item.detailAddress}}
      </div>
      <slot name="charts"></slot>
      <slot name="btn"></slot>
    </div>
  </div>
</template>
<script>
export default {
  name: "Detail",
  props: {
    item: {
      type: Object,
    },
  },
  data() {
    return {};
  },
  methods:{
    closeDetail(){
      this.$emit('closeDetail')
    }
  }
};
</script>
<style lang="less" scoped>
.card-wrapper {
  background: #fff;
  padding: 10px;
  border-radius: 5px;
  height: 700px;
  overflow-y: scroll;
  .card-control{
    line-height: 30px;
    text-align: right;
    .el-icon-close{
      font-size: 20px;
      cursor: pointer;
    }
  }
  .card-desc {
    flex: 1;
    text-align: left;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    .card-warning {
      font-size: 16px;
      color: #ff001a;
      line-height: 21px;
      position: relative;
      margin: 25px 0;
      padding-left: 25px;
      img {
        position: absolute;
        top: 50%;
        left: 0;
        transform: translateY(-50%);
      }
      span {
        margin-left: 10px;
      }
    }
    .card-title {
      font-weight: bold;
      color: #1b232d;
      font-size: 20px;
      margin: 25px 0;
    }
    .card-status {
      em {
        display: inline-block;
        width: 24px;
        height: 13px;
        background: #FFC73A;
        border-radius: 10px;
        margin-right: 10px;
      }
      .text-green{
        background: #7ecf69;
      }
      font-size: 14px;
      color: #1b232d;
      margin-bottom: 15px;
    }
    .card-line {
      padding-left: 30px;
      font-size: 14px;
      color: #1b232d;
      position: relative;
      margin-bottom: 15px;
      img {
        position: absolute;
        top: 50%;
        left: 0;
        transform: translateY(-50%);
      }
    }
  }
  .card-img {
    img {
      width: 317px;
      height: auto;
    }
  }
}
</style>
